The Dialog Control Font Table Resource
NEW WITH THE APPEARANCE MANAGER
Your application can specify the initial font settings for all controls in a dialog box or alert box by creating a dialog control font table resource of type'dftb'
with the same resource ID as the item list resource ('DITL'
). When an embedding hierarchy is established in a dialog box, the dialog control font table resource should be used instead of the item color table ('ictb')
resource, since edit and static text dialog items become controls in an embedding hierarchy.The control font style information in the dialog control font table resource is automatically read in (along with the
'DITL'
) by the Dialog Manager.When the
'dftb'
resource is read in, the control font styles are set, and the resource is marked purgeable. Figure 4-4 shows the format of a compiled dialog control font table resource.
Figure 4-4 Structure of a compiled dialog control font table('dftb')
resource
A compiled version of a
'dftb'
resource contains the following elements:
Figure 4-5 shows the format of a compiled dialog control font entry in a
- Version number. An integer specifying the version of the format of the resource.
- Number of entries. An integer that specifies the number of entries in the resource. Each entry is a dialog control font structure.
- Dialog control font entries. A series of dialog control font structures, each of which consist of type, dialog font flags, the font ID, font size, font style, text mode, justification, text color, background color, and font name.
'dftb'
resource.
Figure 4-5 Structure of dialog control font entry in a'dftb'
resource
Each entry in a
'dftb'
resource corresponds to a dialog item and contains the following elements:
- Type. An integer that specifies whether there is font information for the dialog or alert item in the
'DITL'
. If you specify a value of 0, there is no font information for the item in the corresponding'DITL'
, and no data follows. If you specify a value of 1, there is font information for the item, and the rest of the structure is read. You can cause entries to be skipped by setting this value to 0.- Dialog font flags. You can use one or more of these flag constants to specify which other fields in the dialog font table should be used; see "Dialog Font Flag Constants".
- Font ID. If the
kDialogFontUseFontMask
bit is set to 1, then this element will contain an integer indicating the ID of the font family to use. See "Meta Font Constants" for more information about the constants that you can specify. If this bit is set to 0, then the system default font is used.- Font size. If a constant representing the system font, small system font, or small emphasized system font is specified in the Font ID field, this field is ignored. If the
kDialogFontUseSizeMask
bit is set, this field should contain an integer representing the point size of the text. If thekDialogFontAddSizeMask
bit is set, this value will contain the size to add to the current point size of the text.- Style. If the
kDialogFontUseFaceMask
bit is set, then this element should contain an integer specifying the text style to describe which styles to apply to the text. You can use one or more of the followingstyle
data type mask constants to specify font style:
Bit
valueStyle 0x00 Normal 0x01 Bold 0x02 Italic 0x04 Underline 0x08 Outline 0x10 Shadow 0x20 Condense 0x40 Extend - Text mode. If the
kDialogFontUseModeMask
bit is set, then this element should contain an integer specifying how characters are drawn. See Inside Macintosh: Imaging With QuickDraw for a discussion of source transfer modes.- Justification. If the
kDialogFontUseJustMask
bit is set, then this element should contain an integer specifying text justification (left, right, centered, or system-justified).- Text color. If the
kDialogUseFontForeColorMask
bit is set, then this element should contain a color to use when drawing the text.- Background color. If the
kDialogFontUseBackColorMask
bit is set, then this element should contain a color to use when drawing the background behind the text. In certain text modes, background color is ignored.- Font name. If the
kDialogFontUseFontNameMask
bit is set, then this element should contain a Pascal string representing the font name to be used. This overrides the font ID.
Subtopics
- Dialog Font Flag Constants